/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import static Frames.StoreView.printStoresTable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.proteanit.sql.DbUtils;

/**
 *
 * @author Mixalis
 */
public class StoreView_Dao {

    public void storeViewPrint() throws IllegalArgumentException {

        Connection conn = null;
        ResultSet rs = null;
        PreparedStatement pst = null;;
        try {
            conn = javaconnect.connectDB();
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(StoreEntry_Dao.class.getName()).log(Level.SEVERE, null, ex);
        }

        String query = "SELECT StoreName ,Address ,City ,StorePhone, Seats ,Parking, DaysOpen FROM stores";
        try {
            pst = conn.prepareStatement(query);
            rs = pst.executeQuery();
            printStoresTable.setModel(DbUtils.resultSetToTableModel(rs));
            pst.close();
            conn.close();
            rs.close();
        } catch (SQLException e) {
            throw new IllegalArgumentException("Error in PrintStores_Dao ");
        }

    }
}
